#include<stdio.h>
#include<pthread.h>
#include<unistd.h>

pthread_mutex_t print_mutex=(pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;

void* loop_printf(void *args){
    sleep(10);
    for(int i=0;i<10;i++){
        pthread_mutex_lock(&print_mutex);
        printf("thread2\n");
        pthread_mutex_unlock(&print_mutex);
    }
    return NULL;
}

int main(){
    pthread_t tid;
    pthread_mutex_lock(&print_mutex);
    printf("thread1\n");
    pthread_mutex_unlock(&print_mutex);
    pthread_create(&tid,NULL,loop_printf,NULL);
    char str[100];
    scanf("%s",str);
    printf("result:%s\n",str);
}